-
Notifications
You must be signed in to change notification settings - Fork 239
initial class to represent the EventBridge message format. #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
private String version; | ||
private String id; | ||
private String detailType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this will get serialized as the field which comes in event looks like detail-type.
Untill and unless jackson understands the hypen to get converted into camelCase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely correct. I'm working with the Lambda team to sort this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private String time; | ||
private String region; | ||
private List<String> resources; | ||
private Object detail; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this an object here while it is a map in https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ScheduledEvent.java.
Actually, I agree with the object more than the map... maybe I miss something.
@Builder(setterPrefix = "with") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class EventBridgeEvent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the EventBridge "Download code bindings" feature actually provides an AWSEvent (below). Is it useful to have it in the lib, and if so, why not simply use the generic one below?
public class AWSEvent<T> {
@JsonProperty("detail")
private T detail = null;
@JsonProperty("detail-type")
private String detailType = null;
@JsonProperty("resources")
private List resources = null;
@JsonProperty("id")
private String id = null;
@JsonProperty("source")
private String source = null;
@JsonProperty("time")
private Date time = null;
@JsonProperty("region")
private String region = null;
@JsonProperty("version")
private String version = null;
@JsonProperty("account")
private String account = null;
// ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the Lambda service would be able to handle the typing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately not at this point, the Java runtime needs to handle @JsonProperty
annotations internally
Closing. EventBridge is a new service based on CloudWatch Events. The CloudWatch scheduled event object should meet the same requirements. |
Yeah looks the same but need a workaround for detail-type field :) cause lamdba is not mapping it, I also tried using @JsonProperty("detail-type") but got no luck |
Issue #, if available:
#109
Description of changes:
Adding support for EventBridge / CloudWatch Events
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.